package com.guchenbo.lssp.core;

import com.guchenbo.lssp.exception.SessionException;
import com.guchenbo.lssp.pool.LivyHelper;

/**
 * @author guchenbo
 */
public class Session {

    private Long id;
    private final LivyHelper livyHelper;

    public Session(LivyHelper livyHelper) {
        this.livyHelper = livyHelper;
    }

    public Statement createStatement(String sql) throws SessionException {
        Statement statement = livyHelper.createStatement(id, sql);
        statement.setSessionId(getId());
        statement.setLivyHelper(livyHelper);
        return statement;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}
